//package com.mgkj;
//
//import cn.hutool.core.bean.BeanUtil;
//import cn.hutool.core.date.DateTime;
//import cn.hutool.core.date.DateUtil;
//import com.alibaba.fastjson.JSON;
//import com.baomidou.mybatisplus.core.metadata.IPage;
//import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
//import com.github.pagehelper.PageHelper;
//import com.github.pagehelper.PageInfo;
//import com.mgkj.base.HttpResult;
//import com.mgkj.common.result.Result;
//import com.mgkj.common.utils.HttpClientUtil;
//import com.mgkj.common.utils.MD5;
//import com.mgkj.dto.MessageDto;
//import com.mgkj.dto.PurchaseArrivalStorageWaitCheckDto;
//import com.mgkj.entity.InvBarcodeOperation;
//import com.mgkj.entity.InvBarcodeTransaction;
//
//
//import com.mgkj.entity.Purth;
//import com.mgkj.entity.ShenHe;
//import com.mgkj.mapper.EnterStorageMapper;
//import com.mgkj.mapper.PurchaseMapper;
//import com.mgkj.service.InvBarcodeOperationService;
//import com.mgkj.service.InvBarcodeTransactionService;
//import com.mgkj.service.SyncService;
//import com.mgkj.service.WeChatService;
//import com.mgkj.vo.PurchaseArrivalCheckHeader;
//import com.mgkj.vo.PurchaseArrivalDVo;
//import com.mgkj.vo.PurchaseReceiptStorageVo;
//import com.mgkj.vo.WaitToInspectedVo;
//import org.junit.jupiter.api.Test;
//import org.slf4j.Logger;
//import org.slf4j.LoggerFactory;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.boot.test.context.SpringBootTest;
//
//import javax.annotation.Resource;
//import java.net.InetAddress;
//import java.text.SimpleDateFormat;
//import java.time.LocalDate;
//import java.time.LocalDateTime;
//import java.time.format.DateTimeFormatter;
//import java.util.ArrayList;
//import java.util.Date;
//import java.util.List;
//import java.util.Objects;
//import java.util.stream.Collectors;
//
///**
// * @author : ssy
// * @date: 2023-12-18
// * @Description:
// */
//@SpringBootTest
//public class test {
//
////    @Autowired
////    MOCTAMapper moctaMapper;
//    @Autowired
//    private WeChatService weChatService;
//
//    @Autowired
//    private InvBarcodeOperationService invBarcodeOperationService;
//
//    @Autowired
//    private InvBarcodeTransactionService invBarcodeTransactionService;
//    @Autowired
//    private PurchaseMapper purchaseMapper;
//    @Resource
//    private SyncService syncService;
//
//    @Resource
//    private EnterStorageMapper enterStorageMapper;
//
//
//    private final Logger logger = LoggerFactory.getLogger(getClass());
//    @Test
//    public void test(){
//        LocalDateTime now = LocalDateTime.now();
//        // 创建一个SimpleDateFormat对象来格式化日期
//        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.SSSSSSS");
//        String dateString = now.format(formatter);
//
////        String nowTimeNew = new SimpleDateFormat("yyyyMMddHHmmss").
////                format(new Date());
//        System.out.println(dateString);
//    }
//
//
////    @Test
////    public void test1(){
////        Page<MOCTA> page = new Page<>(1,3);
////        IPage<MOCTA> moctaiPage = moctaMapper.selectAll(page);
////        List<MOCTA> list = moctaiPage.getRecords();
////        System.out.println(list);
////    }
//
//    @Test
//    public void test2() {
//        WaitToInspectedVo head = purchaseMapper.getWaitToInspected("3600-202411270030");
//        //单身
//        List<PurchaseArrivalDVo> body = purchaseMapper.getWaitToInspectedD("3600-202411270030");
//        //获取仓库编号唯一列表
//        List<String> warehouseList = body.stream().map(PurchaseArrivalDVo::getWarehouseCode).distinct().collect(Collectors.toList());
//        //根据仓库列表查对应检验员
//        if (warehouseList != null) {
//            List<String> qcList = purchaseMapper.getInspectorByWarehouse(warehouseList);
//            //去除数组中的null值
//            qcList = qcList.stream().filter(Objects::nonNull).collect(Collectors.toList());
//            MessageDto messageDto = new MessageDto();
//            StringBuilder content = new StringBuilder();
//            // 拼接头部信息
//            content.append("供应商：").append(head.getSupplierName())
//                    .append(" , 到货单单号：").append(head.getDeliveryNo())
//                    .append("，到货日期：").append(head.getDeliveryDate()).append("\n");
//
//            // 拼接到货明细信息
//            content.append("到货明细: ");
//            for (int i = 0; i < body.size(); i++) {
//                PurchaseArrivalDVo detail = body.get(i);
//                content.append(detail.getXh()).append("、 客户单号：").append(detail.getCustomerNo())
//                        .append("，待检验物料：").append(detail.getItemCode()).append("-").append(detail.getItemName());
//                if (i < body.size() - 1) {
//                    content.append("\n               ");
//                }
//            }
////            qcList.add("ZouJinLin");
//            System.out.println(qcList);
//            messageDto.setContent(content.toString());
//            messageDto.setTouser(qcList);
//            weChatService.sendWXMessage(messageDto);
//        }
//    }
//
//
//    @Test
//    public void test3() {
//        InvBarcodeOperation invBarcodeOperation = invBarcodeOperationService.getById("");
//        InvBarcodeTransaction invBarcodeTransaction = new InvBarcodeTransaction();
//        BeanUtil.copyProperties(invBarcodeOperation, invBarcodeTransaction);
//        boolean save = invBarcodeTransactionService.save(invBarcodeTransaction);
//        if (!save) {
//            System.out.println("保存条码结果档失败");
//        }
//    }
////    @Test
////    public void test4() throws Exception {
////        PageHelper.startPage(1,10);
////
////        List<PurchaseArrivalCheckHeader> headerList = purchaseMapper.ListPurchaseArrivalWaitCheckHeader("","","1","10142","1");
////        System.out.println(headerList);;
////
////    }
//
//
////    @Test
////    public void testQuery() {
////        String createBy = "ERP"; // 替换为实际值
////        List<PurchaseReceiptStorageVo> list = purchaseMapper.getInvBarcodeOperationVo(createBy);
////
////        // 打印关键信息
////        System.out.println("查询结果数量：" + list.size());
////        if (!list.isEmpty()) {
////            System.out.println("第一条数据：" + list.get(0));
////            // 验证某个字段是否映射正确（比如 parentId）
////            System.out.println("parentId 映射结果：" + list.get(0).getParentId());
////        }
////    }
//
//    @Test
//    public Result test10() {
//
//                ShenHe shenHe = new ShenHe();
//        shenHe.setCom("1000");
//        shenHe.setProgram("PURI09");
//        shenHe.setUser("MES");
//        shenHe.setDb("3410");
//        shenHe.setDh("20250807001");
//        shenHe.setType("DS");
//        shenHe.setRq("20250807");
//
////        InetAddress localhost = InetAddress.getLocalHost();
////        String ipAddress = localhost.getHostAddress();
////        String url = "http://" + ipAddress + ":9000/api/yifei/audit";
//        String url = "http://" + "192.168.1.192" + ":9000/api/yifei/audit";
//
//
//        String jsonString = JSON.toJSONString(shenHe);
//        String ans = null;
//        try {
////            ShenHe anss=restTemplate.postForObject(url,shenHe,ShenHe.class);
//            ans = HttpClientUtil.postRequest(url, jsonString);
//        } catch (Exception e) {
//
//            return Result.fail("出现异常请查看审批后台是否开启");
//        }
//        HttpResult httpResult = new HttpResult();
//
//        if (ans == null) {
//            return Result.fail("出现异常请查看审批后台是否开启");
//        } else {
//            httpResult = JSON.parseObject(ans, HttpResult.class);
////            System.out.println("httpResult: " + httpResult);
//        }
//        if (httpResult.getStatus().equals("失败")) {
//
//            return Result.fail(httpResult.getReason() + httpResult.getDetail());
//        }
//        System.out.println("审批结果：" + httpResult.getReason() + httpResult.getDetail());
//        return null;
//    }
//
//
//
//
//
//}
